package com.winkyle.woodenfish.controller.fragment;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.winkyle.woodenfish.R;
import com.winkyle.woodenfish.databinding.FragmentItemsBinding;
import com.winkyle.woodenfish.factory.presenterfactory.CreatePresenter;
import com.winkyle.woodenfish.mvpview.ItemsView;
import com.winkyle.woodenfish.presenter.ItemsPresenter;

/**
 * @author winkyle
 * @date 2018/06/20
 * @description 继承自 {@link AbstractMvpFragment}的碎片类ItemsFragment，app的项目页
 */
@CreatePresenter(value = ItemsPresenter.class)
public class ItemsFragment  extends AbstractMvpFragment<ItemsView,ItemsPresenter> implements ItemsView {

    private FragmentItemsBinding fragmentItemsBinding;
    /**
     * @description 碎片创建，指定layout布局
     * @param inflater
     * @param container
     * @param savedInstanceState 保存的碎片状态的数据
     * @return
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_items, container, false);
        fragmentItemsBinding = DataBindingUtil.bind(view);
        initFragment();
        return view;
    }


    /**
     * @description 初始化碎片的一些数据和动作
     * @return
     */
    private void initFragment() {
        fragmentItemsBinding.setItemsView(this);
    }

}
